package com.ryskoo.customer.customeraccount.service;

import com.ryskoo.customer.customeraccount.domain.CustomerAccountPO;
import com.ryskoo.customer.customeraccount.repository.ICustomerAccountRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * 会员数据信息业务基础处理
 * 
 * @author huanghe
 *
 */
@Service
@Transactional
public class CustomerAccountServiceImpl extends BasicServiceImpl<CustomerAccountPO> implements ICustomerAccountService {

	@Autowired
	private ICustomerAccountRepository customerAccountRepository;

	@PostConstruct
	public void init() {
		this.setDao(customerAccountRepository);
	}

	/**
	 * 根据 customerUuids 查询customerAccount
	 * 
	 * @param customerUuids
	 * @return
	 */
	public List<CustomerAccountPO> getByCustomerUuids(List<String> customerUuids) {
		return customerAccountRepository.getByCustomerUuids(customerUuids);
	}

	/**
	 * 根据 customerUuid 查询customerAccount
	 * 
	 * @param customerUuid
	 * @return
	 */
	public CustomerAccountPO getByCustomerUuid(String customerUuid) {
		return customerAccountRepository.getByCustomerUuid(customerUuid);
	}

	/**
	 * 根据 customerUuids 删除 customerAccount
	 * 
	 * @param List<String>
	 *            needDeleteCustomerUuids
	 * @return
	 */
	public void deletesByCustomerUuids(List<String> needDeleteCustomerUuids) {
		customerAccountRepository.deletesByCustomerUuids(needDeleteCustomerUuids);
	}
}
